package com.lemei.cn.myokhttpbeen.viewholder;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.lemei.cn.myokhttpbeen.GoogleApp;
import com.lemei.cn.myokhttpbeen.R;
import com.lemei.cn.myokhttpbeen.been.SubjectItemBeen;
import com.lemei.cn.myokhttpbeen.utils.Uris;

import butterknife.Bind;

/**
 * Created by 赵航 on 2017/6/11.
 */

public class SubjectViewHolder extends BeasicViewHolder<SubjectItemBeen> {

    @Bind(R.id.iv_image)
    ImageView ivImage;
    @Bind(R.id.tv_des)
    TextView  tvDes;
    private View mView;

    //写入参数

    @Override
    public void bindView(SubjectItemBeen items) {
        tvDes.setText(items.getDes());
        Glide.with(GoogleApp.context)
                .load(Uris.IMAGEURI+ items.getUrl())
                .placeholder(R.mipmap.ic_launcher)
                .crossFade()
                .into(ivImage);
    }

    //植入布局
    @Override
    public View getItemView() {
        mView = View.inflate(GoogleApp.context, R.layout.adapter_subject, null);
        return mView;
    }
}

